

var initialState = {
    token: '',
    recod: {},
}

export default function reducer(state = initialState, action: any) {
    //深拷贝state数据
    var newstate = JSON.parse(JSON.stringify(state))
    if (action.type == "CUN_TOKEN") {
        console.log(action.payload)
        newstate.token = action.payload
    } else if (action.recod == "SET_RECOD") {
        console.log(action.payload)
        newstate.search = action.payload
    } else {  //当你如果出发了一个和上面都不匹配的操作之后，说明你不需要去操作
        return state
    }
    return newstate
}